x86emul: enforce privilege level restrictions when loading CS
authorJan Beulich <jbeulich@suse.com>
Tue, 18 Nov 2014 13:16:23 +0000 (14:16 +0100)
committerJan Beulich <jbeulich@suse.com>
Tue, 18 Nov 2014 13:16:23 +0000 (14:16 +0100)
commit1d68c1a70e00ed95ef0889cfa005379dab27b37d
treed95b1eef876b163803519cf25eafaad3c4a9e63f
parente4292c5aac41b80f33d4877104348d5ee7c95aa4
x86emul: enforce privilege level restrictions when loading CS

Privilege level checks were basically missing for the CS case, the
only check that was done (RPL == DPL for nonconforming segments)
was solely covering a single special case (return to non-conforming
segment).

Additionally in long mode the L bit set requires the D bit to be clear,
as was recently pointed out for KVM by Nadav Amit
<namit@cs.technion.ac.il>.

Finally we also need to force the loaded selector's RPL to CPL (at
least as long as lret/retf emulation doesn't support privilege level
changes).

This is CVE-2014-8595 / XSA-110.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/arch/x86/x86_emulate/x86_emulate.c